<?php
session_start(); // start up your PHP session!

if ($_GET['id']) {
    $idCar = $_GET['id'];
} else {
    header('Location:http://www.importadordirectousa.com/');
}
require_once '../../databaseutility/CarroManager.php';
$link = new CarroManager();
if (isset($_REQUEST['id']))
    $id = $_REQUEST['id'];
else
    $id = "";

if ($id != "") {
    $CarroArray = $link->GetCarroInfo($id);
}
?>
<!DOCTYPE html>

<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->

    <head>
        <meta charset="utf-8" />

        <!-- Set the viewport width to device width for mobile -->
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <link href="favicon.ico" rel="icon" type="image/x-icon" />

        <title>ImportadorDirectoUsa.com</title>

        <!-- Included CSS Files -->
        <link rel="stylesheet" href="stylesheets/app.css">
        <link rel="stylesheet" href="stylesheets/social_foundicons.css">

        <script src="javascripts/foundation/modernizr.foundation.js"></script>
        <?php include "../../livehelp_header.php"; ?>
        <meta property="og:title" content="<?php echo $CarroArray[0][46] . " " . $CarroArray[0][7]; ?>" />
        <meta property="og:description" content="<?php echo "Año: " . $CarroArray[0][11] . " - Precio: $" . $CarroArray[0][12]; ?>" />

        <?php
        if ($id != "") {
            $ImageArray2 = $link->GetImageByCarro($id);
            if (!empty($ImageArray2)) {
                for ($i = 0; $i < 1; $i++) {
                    $id2 = 0;
                    $id2 = $ImageArray2[0][$i];
                    if ($id2 != 0) {
                        $imagen2 = $link->GetImageInfo($id2);
                        echo '<a href="pictures/' . $imagen2[0][1] . '"></a></div>';
                    }
                }
            }
        }
        ?>
        <meta property="og:image" content="<?php echo 'http://www.importadordirectousa.com/pictures/' . $imagen2[0][1]; ?>" />
    </head>
    <body>

        <!-- Navigation -->

        <nav class="top-bar fixed">
            <ul>
                <li class="name"><h1><a href="#">ImportadorDirectoUsa.com</a></h1></li>
                <li class="toggle-topbar"><a href="#"></a></li>
            </ul>

            <section>
                <ul class="left">
                    <li><a href="#"></a></li>
                </ul>

                <ul class="right">
                    <li class="has-dropdown">
                        <a href="#">Menu</a>

                        <ul class="dropdown">
                            <li><label>MENU PRINCIPAL</label></li>
                            <li class="divider"></li>
                            <li><a href="#">Inicio</a></li>
                            <li><a href="#">Quienes Somos</a></li>
                            <li><a href="#">Pedidos &AMP; Cotizaciones</a></li>
                            <li><a href="#">Subastas</a></li>
                            <li><a href="#">Cuentas</a></li>
                            <li><a href="#">Contactenos</a></li>
                        </ul>
                    </li>
                    <li class="divider show-for-medium-and-up"></li>
                    <li class="has-dropdown">
                        <a href="#">Categorias</a>
                        <ul class="dropdown">
                            <li><label>CATEGORIAS</label></li>
                            <li class="divider"></li>
                            <li><a href="#">Todo terreno 4x4</a></li>
                            <li><a href="#">Todo terreno 4x2</a></li>
                            <li><a href="#">Pick up 4x4</a></li>
                            <li><a href="#">Pick up 4x2</a></li>
                            <li><a href="#">Sedan</a></li>
                            <li><a href="#">Motos &AMP; Cuadras</a></li>
                            <li><a href="#">Coupe-Hatchback</a></li>
                            <li><a href="#">Equipo pesado</a></li>
                            <li><a href="#">Historicos</a></li>
                        </ul>
                    </li>
                    <li class="divider show-for-medium-and-up"></li>
                    <li class="has-dropdown">
                        <a href="#">Pa&iacute;ses</a>
                        <ul class="dropdown">
                            <li><label>PAISES</label></li>
                            <li class="divider"></li>
                            <li><a href="#">Costa Rica</a></li>
                            <li><a href="#">Nicaragua</a></li>
                            <li><a href="#">Guatemala</a></li>
                            <li><a href="#">Honduras</a></li>
                        </ul>
                    </li>
                    <li class="divider show-for-medium-and-up"></li>
                    <li><a href="#" onclick="openLiveHelp();
                            return false;">Chat en linea</a></li>
                </ul>
            </section>
        </nav>

        <!-- End Navigation -->

        <div class="twelve columns social-media hide-for-small">
            <div class="row hide-for-small">
                <div class="six columns">
                    <!--<div id="fb-root"></div>
                    <script>(function(d, s, id) {
                            var js, fjs = d.getElementsByTagName(s)[0];
                            if (d.getElementById(id))
                                return;
                            js = d.createElement(s);
                            js.id = id;
                            js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
                            fjs.parentNode.insertBefore(js, fjs);
                        }(document, 'script', 'facebook-jssdk'));</script>
                    <div class="fb-like" data-href="http://www.importadordirectousa.com/" data-send="true" data-width="450" data-show-faces="false" data-font="arial"></div>-->
                </div>
                <div class="six columns right">
                    <div id="siteseal"><!--<script type="text/javascript" src="https://seal.starfieldtech.com/getSeal?sealID=DLWOPBf2mYUlrEOA4y9gsUyynUyc0yPcC43n1HMsKsxILxgbyGmmZKob"></script>--></div>
                </div>
            </div>
        </div>

        <div class="row hide-for-small">
            <div class="twelve columns">

                <!-- Desktop Slider -->

                <div>
                    <div id="featured">
                        <img src="images/banner1.jpg" alt="slide image">
                        <img src="images/banner2.jpg" alt="slide image">
                        <img src="images/banner3.jpg" alt="slide image">
                        <!--<img src="http://placehold.it/1200x500&text=Imagen 3" alt="slide image">
                        <img src="http://placehold.it/1200x500&text=Imagen 4" alt="slide image">
                        <img src="http://placehold.it/1200x500&text=Imagen 5" alt="slide image">
                        <img src="http://placehold.it/1200x500&text=Imagen 6" alt="slide image">-->
                    </div>
                </div>

                <!-- End Desktop Slider -->

            </div>
        </div>

        <div class="row">
            <div class="twelve columns">
                <hr>
            </div>
        </div>

        <?php
        require_once '../../databaseutility/CarroManager.php';
//error_reporting(0);
        $Dboj = new CarroManager();
        ?>
        <!-- Cars Section -->
        <?php if (!empty($CarroArray)) : ?>
            <div class="row">
                <div class="twelve columns">
                    <ul class="tabs-content">
                        <li class="active" id="clearingExTab">
                            <div class="row">
                                <div class="six columns">
                                    <table class="responsive" style="width:100%;">
                                        <tbody>
                                            <tr>
                                                <th colspan="2">
                                        <center><?php echo $CarroArray[0][46] . " " . $CarroArray[0][7]; ?></center>
                                        </th>
                                        </tr>
                                        <tr>
                                            <td><strong>A&ntilde;o:</strong></td>
                                            <td><?php echo $CarroArray[0][11]; ?></td>
                                        </tr>
                                        <tr>
                                            <td><strong>Descripci&oacute;n:</strong></td>
                                            <td>
                                                <ul>
                                                    <?php
                                                    echo "<li>".$CarroArray[0][40]."</li>";
                                                    if ($CarroArray[0][18] == 'Y')
                                                        echo "<li>Hidraulico</li>";
                                                    if ($CarroArray[0][19] == 'Y')
                                                        echo "<li>Cierre Central</li>";
                                                    if ($CarroArray[0][20] == 'Y')
                                                        echo "<li>Vidrios Tintados</li>";
                                                    if ($CarroArray[0][21] == 'Y')
                                                        echo "<li>Vidrios El&eacute;cticos</li>";
                                                    if ($CarroArray[0][22] == 'Y')
                                                        echo "<li>Bolsa de Aire</li>";
                                                    if ($CarroArray[0][23] == 'Y')
                                                        echo "<li>Alarma</li>";
                                                    if ($CarroArray[0][24] == 'Y')
                                                        echo "<li>Espejos El&eacute;cticos</li>";
                                                    if ($CarroArray[0][25] == 'Y')
                                                        echo "<li>Aire Acondicionado</li>";
                                                    if ($CarroArray[0][26] == 'Y')
                                                        echo "<li>Disco Compacto</li>";
                                                    if ($CarroArray[0][27] == 'Y')
                                                        echo "<li>Cruise Control</li>";
                                                    if ($CarroArray[0][28] == 'Y')
                                                        echo "<li>RTV</li>";
                                                    ?>
                                                </ul>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td><strong>Tipo:</strong></td>
                                            <td><?php echo $CarroArray[0][5]; ?></td>
                                        </tr>
                                        <tr>
                                            <td><strong>Transmision:</strong></td>
                                            <td><?php echo $CarroArray[0][8]; ?></td>
                                        </tr>
                                        <tr>
                                            <td><strong>Combustible:</strong></td>
                                            <td><?php echo $CarroArray[0][10]; ?></td>
                                        </tr>
                                        <tr>
                                            <td><strong>Puertas:</strong></td>
                                            <td><?php
                                                if ($idCarrocerria != 2) {
                                                    echo $CarroArray[0][13];
                                                }
                                                    ?></td>
                                        </tr>
                                        <tr>
                                            <td><strong>Cilindrada:</strong></td>
                                            <td><?php echo $CarroArray[0][14]; ?></td>
                                        </tr>
                                        <tr>
                                            <td><strong>Kilometraje:</strong></td>
                                            <td><?php echo $CarroArray[0][17]; ?></td>
                                        </tr>
                                        <tr>
                                            <td><strong>Color Exterior:</strong></td>
                                            <td><?php echo $CarroArray[0][15]; ?></td>
                                        </tr>
                                        <tr>
                                            <td><strong>Color Interior:</strong></td>
                                            <td><?php
                                            if ($idCarrocerria != 2) {
                                                echo $CarroArray[0][16];
                                            }
                                                    ?></td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <div class="six columns">
                                    <div class="carousel">
                                        <ul class="block-grid five-up mobile-two-up" data-clearing="">
                                            <?php
                                            if ($id != "") {
                                                $ImageArray = $link->GetImageByCarro($id);
                                                if (!empty($ImageArray)) {
                                                    for ($i = 0; $i < 10; $i++) {
                                                        $id = 0;
                                                        $id = $ImageArray[0][$i];
                                                        if ($id != 0) {
                                                            $imagen = $link->GetImageInfo($id);
                                                            echo '<li>';
                                                            echo '<a href="../../pictures/' . $imagen[0][1] . '"class="th2">';
                                                            echo '<img src="../../pictures/' . $imagen[0][1] . '" border="0" />';
                                                            echo '</a>';
                                                            echo '</li>';
                                                        }
                                                    }
                                                }
                                            }
                                            ?>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </li>
                    </ul>

                </div>
            </div>
        <?php endif; ?>
        <!-- End of Cars Section -->

        <div class="row">
            <div class="twelve columns">
                <hr>
            </div>
        </div>

        <div class="row">
            <div class="twelve columns">
                <ul class="breadcrumbs">
                    <li><a href="#">Vehiculos nuevos</a></li>
                </ul>
            </div>
        </div>

        <!-- New Cars Section -->
        <div class="row">

            <?php
            $NewCarroArray = $Dboj->GetAllCarrosNew2();

            for ($j = 0; $j < count($NewCarroArray); $j++) {

                echo '<div class = "two mobile-two columns">';
                echo '<a href = "info.php?id=' . $NewCarroArray[$j][0] . "'><img src='pictures/" . $NewCarroArray[$j][45] . '.jpg" class = "th"><img src = "../../pictures/' . $NewCarroArray[$j][45] . '"></a>';
                echo '<div class = "panel">';
                echo '<h5>' . $NewCarroArray[$j][44] . " " . $NewCarroArray[$j][7] . " " . $NewCarroArray[$j][11] . '</h5>';
                echo '<h6 class = "subheader">$' . $NewCarroArray[$j][12] . '</h6>';
                echo '</div>';
                echo '</div>';
            }
            ?>

        </div>

        <!-- End of New Cars Section -->

        <footer>
            <div class="row">
                <section class="eight columns">
                    <h6><strong>Compramos su vehiculo en las mejores subastas de USA</strong></h6>
                    <img src="images/auctions.jpg"/>
                </section>

                <section class="four columns">
                    <h6><strong>Necesita ayuda?</strong></h6>
                    <p><a class="secondary radius button" onclick="openLiveHelp();
                            return false;">Chat en línea</a></p>
                    <ul class="inline-list social">
                        <li>
                            <a href="http://www.facebook.com/importador.importadores" target="_blank"><i class="foundicon-facebook"></i></a>
                        </li>
                        <li>
                            <a href="https://plusone.google.com/_/+1/confirm?url=http://www.importadordirectousa.com/&amp;title=Importador%20Directo%20USA" target="_blank"><i class="foundicon-google-plus"></i></a>
                        </li>
                        <li>
                            <a href="http://www.twitter.com/" target="_blank"><i class="foundicon-twitter"></i></a>
                        </li>
                    </ul>
                </section>
            </div>
        </footer>
        <div id="copyright">
            <div class="row">
                <div class="six columns">
                    <p>&COPY; <?php echo date('Y'); ?> Todos los derechos reservados. <a href="http://www.webdesignius.com/" target="_blank">WebDesignius</a></p>
                </div>
                <div class="six columns">
                    <ul class="inline-list right hide">
                        <li><a href="#">Link 1</a></li>
                        <li><a href="#">Link 2</a></li>
                        <li><a href="#">Link 3</a></li>
                        <li><a href="#">Link 4</a></li>
                    </ul>
                </div>
            </div>
        </div>

        <!-- End Mobile Header -->

        <!-- Included JS Files (Uncompressed) -->
        <script src="javascripts/foundation/jquery.js"></script>

        <script src="javascripts/foundation/jquery.cookie.js"></script>

        <script src="javascripts/foundation/jquery.event.move.js"></script>

        <script src="javascripts/foundation/jquery.event.swipe.js"></script>

        <script src="javascripts/foundation/jquery.foundation.accordion.js"></script>

        <script src="javascripts/foundation/jquery.foundation.alerts.js"></script>

        <script src="javascripts/foundation/jquery.foundation.buttons.js"></script>

        <script src="javascripts/foundation/jquery.foundation.clearing.js"></script>

        <script src="javascripts/foundation/jquery.foundation.forms.js"></script>

        <script src="javascripts/foundation/jquery.foundation.joyride.js"></script>

        <script src="javascripts/foundation/jquery.foundation.magellan.js"></script>

        <script src="javascripts/foundation/jquery.foundation.mediaQueryToggle.js"></script>

        <script src="javascripts/foundation/jquery.foundation.navigation.js"></script>

        <script src="javascripts/foundation/jquery.foundation.orbit.js"></script>

        <script src="javascripts/foundation/jquery.foundation.reveal.js"></script>

        <script src="javascripts/foundation/jquery.foundation.tabs.js"></script>

        <script src="javascripts/foundation/jquery.foundation.tooltips.js"></script>

        <script src="javascripts/foundation/jquery.foundation.topbar.js"></script>

        <script src="javascripts/foundation/jquery.placeholder.js"></script>


        <!-- Application Javascript, safe to override -->
        <script src="javascripts/foundation/app.js"></script>

        <script type="text/javascript" src="../../js/jquery.lightbox-0.5.js"></script>
        <link rel="stylesheet" type="text/css" href="../../css/jquery.lightbox-0.5.css" media="screen" />
        <script type="text/javascript">
                        $(window).load(function() {
                            $('#featured').orbit({fluid: '2x1'});
                        });

                        $(function() {
                            $('#gallery a').lightBox();
                            /*START CAR COMPARE*/
                            var maxCompare = 4;
                            var counter = 1;
                            $('.checkCompare').click(function() {
                                if (counter != maxCompare) {
                                    var val = [];
                                    var items = -1;
                                    $('#idCarCompareValues').html('');
                                    $(':checkbox:checked').each(function(i) {
                                        val[i] = $(this).val();
                                        $(this).addClass('selected');
                                        $(this).removeClass('checkCompare');
                                        if (val[i] != 'checkbox') {
                                            $("#idCarCompareValues").append("<input type='hidden' id='carID' name='carID" + i + "' value='" + val[i] + "'>");
                                            $('#carCompareSubmit').attr('disabled', false);
                                        }
                                        items++;
                                    });
                                    $("#idCarCompareValues").append("<input type='hidden' name='counter' id='counter' value='" + items + "'>");

                                    if (!this.checked) {
                                        /*Add class CHECKCOMPARE to checked option and remove class SELECTED from clicked checkbox*/
                                        $(this).addClass('checkCompare');
                                        $(this).removeClass('selected');
                                        counter--;
                                        if (counter == 0) {
                                            this.checked = true;
                                            $('#carCompareSubmit').attr('disabled', true);
                                            alert('Soleccione como m�nimo 2 veh�culos para comparar.');
                                            counter++;
                                        } else {
                                            if (counter == 1) {
                                                alert('Soleccione como mínimo 2 vehículos para comparar.');
                                                this.checked = false;
                                                $('#carCompareSubmit').attr('disabled', true);
                                            }
                                        }
                                    } else {
                                        counter++;
                                    }
                                } else {
                                    if (this.checked) {
                                        alert('Solo 4 vehículos para comparar son permitidos.');
                                        /*Add class CHECKCOMPARE to checked option and remove class SELECTED from clicked checkbox*/
                                        $(this).addClass('checkCompare');
                                        $(this).removeClass('selected');
                                        this.checked = false;
                                        $('.checkCompare').attr('disabled', true);
                                    } else {
                                        $(this).addClass('checkCompare');
                                        $(this).removeClass('selected');
                                        $('.checkCompare').attr('disabled', false);
                                        counter--;
                                        var val = [];
                                        var items = -1;
                                        $('#idCarCompareValues').html('');
                                        $(':checkbox:checked').each(function(i) {
                                            val[i] = $(this).val();
                                            if (val[i] != 'checkbox') {
                                                $("#idCarCompareValues").append("<input type='hidden' id='carID' name='carID" + i + "' value='" + val[i] + "'>");
                                                $('#carCompareSubmit').attr('disabled', false);
                                            }
                                            items++;
                                        });
                                        $("#idCarCompareValues").append("<input type='hidden' name='counter' id='counter' value='" + items + "'>");
                                    }
                                }
                            });
                            /*END CAR COMPARE*/
                            $('#resetButton').click(function() {
                                $('#carCompareSubmit').attr('disabled', true);
                                $('#idCarCompareValues').html('');
                                counter = 1;
                                $('.selected').each(function(i) {
                                    $(this).addClass('checkCompare');
                                    $(this).removeClass('selected');
                                    $('.checkCompare').attr('disabled', false);
                                });
                            });
                        });
                        function MM_swapImgRestore() { //v3.0
                            var i, x, a = document.MM_sr;
                            for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++)
                                x.src = x.oSrc;
                        }
                        function MM_preloadImages() { //v3.0
                            var d = document;
                            if (d.images) {
                                if (!d.MM_p)
                                    d.MM_p = new Array();
                                var i, j = d.MM_p.length, a = MM_preloadImages.arguments;
                                for (i = 0; i < a.length; i++)
                                    if (a[i].indexOf("#") != 0) {
                                        d.MM_p[j] = new Image;
                                        d.MM_p[j++].src = a[i];
                                    }
                            }
                        }

                        function MM_findObj(n, d) { //v4.01
                            var p, i, x;
                            if (!d)
                                d = document;
                            if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
                                d = parent.frames[n.substring(p + 1)].document;
                                n = n.substring(0, p);
                            }
                            if (!(x = d[n]) && d.all)
                                x = d.all[n];
                            for (i = 0; !x && i < d.forms.length; i++)
                                x = d.forms[i][n];
                            for (i = 0; !x && d.layers && i < d.layers.length; i++)
                                x = MM_findObj(n, d.layers[i].document);
                            if (!x && d.getElementById)
                                x = d.getElementById(n);
                            return x;
                        }

                        function MM_swapImage() { //v3.0
                            var i, j = 0, x, a = MM_swapImage.arguments;
                            document.MM_sr = new Array;
                            for (i = 0; i < (a.length - 2); i += 3)
                                if ((x = MM_findObj(a[i])) != null) {
                                    document.MM_sr[j++] = x;
                                    if (!x.oSrc)
                                        x.oSrc = x.src;
                                    x.src = a[i + 2];
                                }
                        }


                        function MyReload()
                        {
                            //window.location.reload();
                            $("#carCompare").reset();
                        }
        </script>

    </body>
</html>